<?php
Loader::loadClass('ObjectUtilEx', "modules/VotePetition/pnincludes");
Loader::loadClass('DateUtilEx', "modules/VotePetition/pnincludes");
Loader::loadClass('PNObjectEx', "modules/VotePetition/pnincludes");
Loader::loadClass('PNObjectExArray', "modules/VotePetition/pnincludes");
Loader::loadClass('DBUtilEx', "modules/VotePetition/pnincludes");
Loader::loadClass('InnoUtil', "modules/VotePetition/pnincludes");

function VotePetition_pntables()
{
    // Initialise table array
    $pntable = array();

    ////////////////////////////////////////////
    //Province table
    ////////////////////////////////////////////
    $pntable['votepetition_province'] = DBUtil::getLimitedTablename('votepetition_province');
    $pntable['votepetition_province_column'] = array(
                                        'id'                => 'pro_id',
                                        'name'              => 'pro_name',
                                        'latitude'          => 'pro_latitude',
                                        'longitude'         => 'pro_longitude'
    );
    $pntable['votepetition_province_column_def'] = array(
                                        'id'                => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'name'              => 'varchar(255)',
                                        'latitude'          => 'text',
                                        'longitude'         => 'text'
    );
    $pntable['votepetition_province_primary_key_column'] = 'id';

    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_province_column'], 'pro_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_province_column_def']);

    ////////////////////////////////////////////
    //District table
    ////////////////////////////////////////////
    $pntable['votepetition_district'] = DBUtil::getLimitedTablename('votepetition_district');
    $pntable['votepetition_district_column'] = array(
                                        'id'                => 'dis_id',
                                        'pro_id'            => 'dis_pro_id',
                                        'name'              => 'dis_name',
                                        'latitude'          => 'dis_latitude',
                                        'longitude'         => 'dis_longitude'
    );
    $pntable['votepetition_district_column_def'] = array(
                                        'id'                => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'pro_id'            => 'INT(11) NOTNULL',
                                        'name'              => 'varchar(255)',
                                        'latitude'          => 'text',
                                        'longitude'         => 'text'
    );
    $pntable['votepetition_district_primary_key_column'] = 'id';

    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_district_column'], 'dis_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_district_column_def']);

    $pntable['votepetition_district_column_idx'] = array('idx_dis_pro_id' => 'pro_id');

    ////////////////////////////////////////////
    //Tambon table
    ////////////////////////////////////////////
    $pntable['votepetition_tambon'] = DBUtil::getLimitedTablename('votepetition_tambon');
    $pntable['votepetition_tambon_column'] = array(
                                        'id'                => 'tam_id',
                                        'pro_id'            => 'tam_pro_id',
                                        'dis_id'            => 'tam_dis_id',
                                        'name'              => 'tam_name',
                                        'latitude'          => 'tam_latitude',
                                        'longitude'         => 'tam_longitude'
    );
    $pntable['votepetition_tambon_column_def'] = array(
                                        'id'                => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'pro_id'            => 'INT(11) NOTNULL',   
                                        'dis_id'            => 'INT(11) NOTNULL',  
                                        'name'              => 'varchar(255)',
                                        'latitude'          => 'text',
                                        'longitude'         => 'text'
    );
    $pntable['votepetition_tambon_primary_key_column'] = 'id';
    
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_tambon_column'], 'tam_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_tambon_column_def']);

    $pntable['votepetition_tambon_column_idx'] = array(
                                                          'idx_tam_pro_id' => 'pro_id',
                                                          'idx_tam_dis_id' => 'dis_id'
    );

    ////////////////////////////////////////////
    //Village table
    ////////////////////////////////////////////
    $pntable['votepetition_village'] = DBUtil::getLimitedTablename('votepetition_village');
    $pntable['votepetition_village_column'] = array(
                                        'id'                => 'vil_id',
                                        'pro_id'            => 'vil_pro_id',
                                        'dis_id'            => 'vil_dis_id',
                                        'tam_id'            => 'vil_tam_id',
                                        'moo'               => 'vil_moo',
                                        'name'              => 'vil_name',
                                        'latitude'          => 'vil_latitude',
                                        'longitude'         => 'vil_longitude'
    );
    $pntable['votepetition_village_column_def'] = array(
                                        'id'                => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'pro_id'            => 'INT(11) NOTNULL',   
                                        'dis_id'            => 'INT(11) NOTNULL',  
                                        'tam_id'            => 'INT(11) NOTNULL',
                                        'moo'               => 'INT(11) NOTNULL',
                                        'name'              => 'varchar(255)',
                                        'latitude'          => 'text',
                                        'longitude'         => 'text'
    );
    $pntable['votepetition_village_primary_key_column'] = 'id';
    
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_village_column'], 'vil_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_village_column_def']);

    $pntable['votepetition_village_column_idx'] = array(
                                                          'idx_vil_pro_id' => 'pro_id',
                                                          'idx_vil_dis_id' => 'dis_id',
                                                          'idx_vil_tam_id' => 'tam_id',
                                                          'idx_vil_moo'   => 'moo'
    );

    ////////////////////////////////////////////
    //Party table
    ////////////////////////////////////////////
    $pntable['votepetition_party'] = DBUtil::getLimitedTablename('votepetition_party');
    $pntable['votepetition_party_column'] = array(
                                        'id'                => 'par_id',
                                        'name'              => 'par_name'
    );
    $pntable['votepetition_party_column_def'] = array(
                                        'id'                => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'name'              => 'varchar(255)'
    );
    $pntable['votepetition_party_primary_key_column'] = 'id';

    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_party_column'], 'par_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_party_column_def']);


    ////////////////////////////////////////////
    //House no. table
    ////////////////////////////////////////////
    $pntable['votepetition_house_no'] = DBUtil::getLimitedTablename('votepetition_house_no');
    $pntable['votepetition_house_no_column'] = array(
                                        'id'                => 'hou_id',
                                        'pro_id'            => 'hou_pro_id',
                                        'dis_id'            => 'hou_dis_id',
                                        'tam_id'            => 'hou_tam_id',
                                        'vil_id'            => 'hou_vil_id',
                                        'vil_moo'           => 'hou_vil_moo',
                                        'no'                => 'hou_no',
                                        'unit'              => 'hou_unit',
                                        'trok'              => 'hou_trok',
                                        'soi'               => 'hou_soi',
                                        'road'              => 'hou_road',
                                        'zipcode'           => 'hou_zipcode',
                                        'latitude'          => 'hou_latitude',
                                        'longitude'         => 'hou_longitude',
                                        'amount_person'     => 'hou_amount_person'

    );
    $pntable['votepetition_house_no_column_def'] = array(
                                        'id'                => 'BIGINT(255) NOTNULL AUTOINCREMENT PRIMARY',
                                        'pro_id'            => 'INT(11) NOTNULL',   
                                        'dis_id'            => 'INT(11) NOTNULL',  
                                        'tam_id'            => 'INT(11) NOTNULL',
                                        'vil_id'            => 'INT(11) NOTNULL',
                                        'vil_moo'           => 'INT(11) NOTNULL',
                                        'no'                => 'varchar(50)',
                                        'unit'              => 'INT(11) NOTNULL',
                                        'trok'              => 'INT(11) ',
                                        'soi'               => 'VARCHAR(255)',
                                        'road'              => 'VARCHAR(255)',
                                        'zipcode'           => 'INT(11) ',
                                        'latitude'          => 'varchar(255)',
                                        'longitude'         => 'varchar(255)',
                                        'amount_person'     => 'INT(11) NOTNULL DEFAULT 0'
    );
    $pntable['votepetition_house_no_primary_key_column'] = 'id';

    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_house_no_column'], 'hou_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_house_no_column_def']);

    $pntable['votepetition_house_no_column_idx'] = array(
                                                           'idx_hou_pro_id' => 'pro_id',
                                                           'idx_hou_dis_id' => 'dis_id',
                                                           'idx_hou_tam_id' => 'tam_id',
                                                           'idx_hou_id'     => 'vil_id',
                                                           'idx_hou_moo'    => 'vil_moo',
    );

    ////////////////////////////////////////////
    //Village table
    ////////////////////////////////////////////
    $pntable['votepetition_villagepoll'] = DBUtil::getLimitedTablename('votepetition_villagepoll');
    $pntable['votepetition_villagepoll_column'] = array(
                                        'id'                => 'pol_id',
                                        'pro_id'            => 'pol_pro_id',
                                        'dis_id'            => 'pol_dis_id',
                                        'tam_id'            => 'pol_tam_id',
                                        'vil_id'            => 'pol_vil_id',
                                        'house_no_id'       => 'pol_house_no_id',
                                        'par_id'            => 'pol_par_id',
                                        'status'            => 'pol_status',
                                        'title'             => 'pol_title',
                                        'comment'           => 'pol_comment'
    );
    $pntable['votepetition_villagepoll_column_def'] = array(
                                        'id'                => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'pro_id'            => 'INT(11) NOTNULL',   
                                        'dis_id'            => 'INT(11) NOTNULL',  
                                        'tam_id'            => 'INT(11) NOTNULL',
                                        'vil_id'            => 'INT(11) NOTNULL',
                                        'house_no_id'       => 'INT(11) NOTNULL',
                                        'par_id'            => 'INT(11) NOTNULL',
                                        'status'            => 'INT(11) NOTNULL',
                                        'title'             => 'VARCHAR(255)',
                                        'comment'           => 'TEXT'
    );
    $pntable['votepetition_villagepoll_primary_key_column'] = 'id';
    
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_villagepoll_column'], 'pol_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_villagepoll_column_def']);

    $pntable['votepetition_villagepoll_column_idx'] = array(
                                                          'idx_pol_pro_id'   => 'pro_id',
                                                          'idx_pol_dis_id'   => 'dis_id',
                                                          'idx_pol_tam_id'   => 'tam_id',
                                                          'idx_pol_vil_id'   => 'vil_id',
                                                          'idx_pol_par_id'   => 'par_id',

    );

    ////////////////////////////////////////////
    //Village research
    ////////////////////////////////////////////
    $pntable['votepetition_research'] = DBUtil::getLimitedTablename('votepetition_research');
    $pntable['votepetition_research_column'] = array(
                                        'id'                => 'res_id',
                                        'titlename'         => 'res_titlename',
                                        'firstname'         => 'res_firstname',
                                        'lastname'          => 'res_lastname',
                                        'pid'               => 'res_pid',
                                        'birthdate'         => 'res_birthdate',
                                        'house_no'          => 'res_house_no',
                                        'soi'               => 'res_soi',
                                        'road'              => 'res_road',
                                        'village_name'      => 'res_village_name',
                                        'pro_id'            => 'res_pro_id',
                                        'dis_id'            => 'res_dis_id',
                                        'tam_id'            => 'res_tam_id',
                                        'vil_id'            => 'res_vil_id',
                                        'zipcode'           => 'res_zipcode',
                                        'telephone'         => 'res_telephone',
                                        'fax'               => 'res_fax',
                                        'mobile'            => 'res_mobile',
                                        'amount_person'     => 'res_amount_person',
                                        'student_person'    => 'res_student_person',
                                        'career_person'     => 'res_career_person',
                                        'latitude'          => 'res_latitude',
                                        'longitude'         => 'res_longitude'
    );
    $pntable['votepetition_research_column_def'] = array(
                                        'id'                => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'titlename'         => 'VARCHAR(255)',
                                        'firstname'         => 'VARCHAR(255)',
                                        'lastname'          => 'VARCHAR(255)',
                                        'pid'               => 'VARCHAR(255)',
                                        'birthdate'         => 'DATE',
                                        'house_no'          => 'VARCHAR(255)',
                                        'soi'               => 'VARCHAR(255)',
                                        'road'              => 'VARCHAR(255)',
                                        'village_name'      => 'VARCHAR(255)',
                                        'pro_id'            => 'INT(11) NOTNULL',
                                        'dis_id'            => 'INT(11) NOTNULL',
                                        'tam_id'            => 'INT(11) NOTNULL',
                                        'vil_id'            => 'INT(11) NOTNULL',
                                        'zipcode'           => 'VARCHAR(255)',
                                        'telephone'         => 'VARCHAR(255)',
                                        'fax'               => 'VARCHAR(255)',
                                        'mobile'            => 'VARCHAR(255)',
                                        'amount_person'     => 'INT(11) NOTNULL',
                                        'student_person'    => 'INT(11) NOTNULL',
                                        'career_person'     => 'INT(11) NOTNULL',
                                        'latitude'          => 'TEXT',
                                        'longitude'         => 'TEXT'
    );
    $pntable['votepetition_research_primary_key_column'] = 'id';
    
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_research_column'], 'res_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_research_column_def']);

    ////////////////////////////////////////////
    //Village person in house
    ////////////////////////////////////////////
    $pntable['votepetition_person_in_house'] = DBUtil::getLimitedTablename('votepetition_person_in_house');
    $pntable['votepetition_person_in_house_column'] = array(
                                        'id'                => 'pih_id',
                                        'res_id'            => 'pih_res_id',
                                        'titlename'         => 'pih_titlename',
                                        'firstname'         => 'pih_firstname',
                                        'lastname'          => 'pih_lastname',
                                        'birthdate'         => 'pih_birthdate',
                                        'career'            => 'pih_career'
    );
    $pntable['votepetition_person_in_house_column_def'] = array(
                                        'id'                => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'res_id'            => 'INT(11) NOTNULL',
                                        'titlename'         => 'VARCHAR(255)',
                                        'firstname'         => 'VARCHAR(255)',
                                        'lastname'          => 'VARCHAR(255)',
                                        'birthdate'         => 'DATE',
                                        'career'            => 'TEXT'
    );
    $pntable['votepetition_person_in_house_primary_key_column'] = 'id';
    
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_person_in_house_column'], 'pih_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_person_in_house_column_def']);

//    $pntable['votepetition_person_in_house_column_idx'] = array(
//                                                          'idx_pih_res_id'   => 'res_id'
//    );

    ////////////////////////////////////////////
    //Career
    ////////////////////////////////////////////
    $pntable['votepetition_career'] = DBUtil::getLimitedTablename('votepetition_career');
    $pntable['votepetition_career_column'] = array(
                                        'id'                  => 'car_id',
                                        'res_id'              => 'car_res_id',
                                        'agriculture_status'  => 'car_agriculture_status',
                                        'agriculture_type'    => 'car_agriculture_type',
                                        'agriculture_amount'  => 'car_agriculture_amount',
                                        'agriculture_product' => 'car_agriculture_product',
                                        'tranform_status'     => 'car_tranform_status',
                                        'tranform_type'       => 'car_tranform_type',
                                        'tranform_amount'     => 'car_tranform_amount',
                                        'tranform_product'    => 'car_tranform_product',
                                        'herdsman_status'     => 'car_herdsman_status',
                                        'herdsman_type'       => 'car_herdsman_type',
                                        'herdsman_amount'     => 'car_herdsman_amount',
                                        'herdsman_product'    => 'car_herdsman_product',
                                        'fisherman_status'    => 'car_fisherman_status',
                                        'fisherman_type'      => 'car_fisherman_type',
                                        'fisherman_amount'    => 'car_fisherman_amount',
                                        'fisherman_product'   => 'car_fisherman_product',
                                        'other_status'        => 'car_other_status',
                                        'other_type'          => 'car_other_type',
                                        'other_amount'        => 'car_other_amount',
                                        'other_product'       => 'car_other_product'
    );
    $pntable['votepetition_career_column_def'] = array(
                                        'id'                  => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'res_id'              => 'INT(11) NOTNULL',
                                        'agriculture_status'  => 'INT(11) NOTNULL',
                                        'agriculture_type'    => 'VARCHAR(255)',
                                        'agriculture_amount'  => 'VARCHAR(255)',
                                        'agriculture_product' => 'VARCHAR(255)',
                                        'tranform_status'     => 'INT(11) NOTNULL',
                                        'tranform_type'       => 'VARCHAR(255)',
                                        'tranform_amount'     => 'VARCHAR(255)',
                                        'tranform_product'    => 'VARCHAR(255)',
                                        'herdsman_status'     => 'INT(11) NOTNULL',
                                        'herdsman_type'       => 'VARCHAR(255)',
                                        'herdsman_amount'     => 'VARCHAR(255)',
                                        'herdsman_product'    => 'VARCHAR(255)',
                                        'fisherman_status'    => 'INT(11) NOTNULL',
                                        'fisherman_type'      => 'VARCHAR(255)',
                                        'fisherman_amount'    => 'VARCHAR(255)',
                                        'fisherman_product'   => 'VARCHAR(255)',
                                        'other_status'        => 'INT(11) NOTNULL',
                                        'other_type'          => 'VARCHAR(255)',
                                        'other_amount'        => 'VARCHAR(255)',
                                        'other_product'       => 'VARCHAR(255)'
    );
    $pntable['votepetition_career_primary_key_column'] = 'id';
    
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_career_column'], 'car_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_career_column_def']);

//    $pntable['votepetition_career_column_idx'] = array(
//                                                          'idx_car_res_id'   => 'res_id'
//    );

    ////////////////////////////////////////////
    //Village career problem
    ////////////////////////////////////////////
    $pntable['votepetition_career_problem'] = DBUtil::getLimitedTablename('votepetition_career_problem');
    $pntable['votepetition_career_problem_column'] = array(
                                        'id'                => 'carp_id',
                                        'res_id'            => 'carp_res_id',
                                        'detail'            => 'carp_detail'
    );
    $pntable['votepetition_career_problem_column_def'] = array(
                                        'id'                => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'res_id'            => 'INT(11) NOTNULL',
                                        'detail'            => 'TEXT'
    );
    $pntable['votepetition_career_problem_primary_key_column'] = 'id';
    
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_career_problem_column'], 'carp_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_career_problem_column_def']);

//    $pntable['votepetition_career_problem_column_idx'] = array(
//                                                          'idx_carp_res_id'   => 'res_id'
//    );

    ////////////////////////////////////////////
    //Village career solve
    ////////////////////////////////////////////
    $pntable['votepetition_career_solve'] = DBUtil::getLimitedTablename('votepetition_career_solve');
    $pntable['votepetition_career_solve_column'] = array(
                                        'id'                => 'cars_id',
                                        'res_id'            => 'cars_res_id',
                                        'detail'            => 'cars_detail'
    );
    $pntable['votepetition_career_solve_column_def'] = array(
                                        'id'                => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'res_id'            => 'INT(11) NOTNULL',
                                        'detail'            => 'TEXT'
    );
    $pntable['votepetition_career_solve_primary_key_column'] = 'id';
    
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_career_solve_column'], 'cars_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_career_solve_column_def']);

//    $pntable['votepetition_career_solve_column_idx'] = array(
//                                                          'idx_cars_res_id'   => 'res_id'
//    );

    ////////////////////////////////////////////
    //Village career solve
    ////////////////////////////////////////////
    $pntable['votepetition_income'] = DBUtil::getLimitedTablename('votepetition_income');
    $pntable['votepetition_income_column'] = array(
                                        'id'                 => 'inc_id',
                                        'res_id'             => 'inc_res_id',
                                        'main_career_title'  => 'inc_main_career_title',
                                        'main_career_amount' => 'inc_main_career_amount',
                                        'main_career_income' => 'inc_main_career_income',
                                        'sub_career_title'   => 'inc_sub_career_title',
                                        'sub_career_amount'  => 'inc_sub_career_amount',
                                        'sub_career_income'  => 'inc_sub_career_income'
    );
    $pntable['votepetition_income_column_def'] = array(
                                        'id'                 => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'res_id'             => 'INT(11) NOTNULL',
                                        'main_career_title'  => 'VARCHAR(255)',
                                        'main_career_amount' => 'VARCHAR(255)',
                                        'main_career_income' => 'VARCHAR(255)',
                                        'sub_career_title'   => 'VARCHAR(255)',
                                        'sub_career_amount'  => 'VARCHAR(255)',
                                        'sub_career_income'  => 'VARCHAR(255)'
    );
    $pntable['votepetition_income_primary_key_column'] = 'id';
    
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_income_column'], 'inc_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_income_column_def']);

//    $pntable['votepetition_income_column_idx'] = array(
//                                                          'idx_inc_res_id'   => 'res_id'
//    );


    ////////////////////////////////////////////
    //Village career solve
    ////////////////////////////////////////////
    $pntable['votepetition_outlay'] = DBUtil::getLimitedTablename('votepetition_outlay');
    $pntable['votepetition_outlay_column'] = array(
                                        'id'                      => 'out_id',
                                        'res_id'                  => 'out_res_id',
                                        'main_career_title'       => 'out_main_career_title',
                                        'main_career_amount'      => 'out_main_career_amount',
                                        'main_career_income'      => 'out_main_career_income',
                                        'sub_career_title'        => 'out_sub_career_title',
                                        'sub_career_amount'       => 'out_sub_career_amount',
                                        'sub_career_income'       => 'out_sub_career_income',
                                        'household_career_title'  => 'out_household_career_title',
                                        'household_career_amount' => 'out_household_career_amount',
                                        'household_career_income' => 'out_household_career_income'
    );
    $pntable['votepetition_outlay_column_def'] = array(
                                        'id'                      => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'res_id'                  => 'INT(11) NOTNULL',
                                        'main_career_title'       => 'TEXT',
                                        'main_career_amount'      => 'VARCHAR(255)',
                                        'main_career_income'      => 'VARCHAR(255)',
                                        'sub_career_title'        => 'TEXT',
                                        'sub_career_amount'       => 'VARCHAR(255)',
                                        'sub_career_income'       => 'VARCHAR(255)',
                                        'household_career_title'  => 'TEXT',
                                        'household_career_amount' => 'VARCHAR(255)',
                                        'household_career_income' => 'VARCHAR(255)'
    );
    $pntable['votepetition_outlay_primary_key_column'] = 'id';
    
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_outlay_column'], 'out_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_outlay_column_def']);

//    $pntable['votepetition_outlay_column_idx'] = array(
//                                                          'idx_out_res_id'   => 'res_id'
//    );

    ////////////////////////////////////////////
    //Village general problem
    ////////////////////////////////////////////
    $pntable['votepetition_general_problem'] = DBUtil::getLimitedTablename('votepetition_general_problem');
    $pntable['votepetition_general_problem_column'] = array(
                                        'id'                => 'genp_id',
                                        'res_id'            => 'genp_res_id',
                                        'problem'           => 'genp_problem'
    );
    $pntable['votepetition_general_problem_column_def'] = array(
                                        'id'                => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'res_id'            => 'INT(11) NOTNULL',
                                        'problem'           => 'TEXT'
    );
    $pntable['votepetition_general_problem_primary_key_column'] = 'id';
    
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_general_problem_column'], 'genp_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_general_problem_column_def']);

//    $pntable['votepetition_general_problem_column_idx'] = array(
//                                                          'idx_genp_res_id'   => 'res_id'
//    );

    ////////////////////////////////////////////
    //Village general problem
    ////////////////////////////////////////////
    $pntable['votepetition_general_solve'] = DBUtil::getLimitedTablename('votepetition_general_solve');
    $pntable['votepetition_general_solve_column'] = array(
                                        'id'                => 'gens_id',
                                        'res_id'            => 'gens_res_id',
                                        'solve'             => 'gens_solve'
    );
    $pntable['votepetition_general_solve_column_def'] = array(
                                        'id'                => 'INT(11) NOTNULL AUTOINCREMENT PRIMARY',
                                        'res_id'            => 'INT(11) NOTNULL',
                                        'solve'             => 'TEXT'
    );
    $pntable['votepetition_general_solve_primary_key_column'] = 'id';
    
    // add standard data fields
    ObjectUtil::addStandardFieldsToTableDefinition ($pntable['votepetition_general_solve_column'], 'gens_');
    ObjectUtil::addStandardFieldsToTableDataDefinition($pntable['votepetition_general_solve_column_def']);

//    $pntable['votepetition_career_solve_column_idx'] = array(
//                                                          'idx_gens_res_id'   => 'res_id'
//    );

    return $pntable;
}